﻿
using System.Data.Entity;

namespace Pe.Petecos.Comercial.Infraestructura.Core.Context
{
    // DropCreateDatabaseIfModelChanges<DeliveryContext> // DropCreateDatabaseAlways //CreateDatabaseIfNotExists<GenericDBContext>

    /// <summary>
    /// Inicialización del contexto Entity Framework
    /// </summary>
    /// <remarks>
    /// Creación:   GMD 22122014 <br />
    /// Modificación:            <br />
    /// </remarks>
    public class DbContextInitializer : CreateDatabaseIfNotExists<ComercialDbContextProvider>
    {
        protected override void Seed(ComercialDbContextProvider context)
        {
            //context.DbSet<UserEntity>().Add(new UserEntity() { UserName = "Admin", Password = "1234" });
            //var pathScript = System.Configuration.ConfigurationManager.AppSettings["InitialScriptSql"];
            //if (File.Exists(pathScript)) {
            //    string script = File.ReadAllText(pathScript);
            //    context.Database.ExecuteSqlCommand(script);
            //}
        }
    }
}
